/*=========================================
Title:  poland.do
Author: Mitchell Hoffman
Purpose: Read Poland data, tabulate ocp status 
=========================================*/

clear
set more off

cd "C:\Users\Mitch"
insheet using "poland.csv"

********************** Create wartime occupation and occupation type

replace occupation="Farmer" if (person=="Man" | person=="Woman") & (farmwords=="Goat Shed, Storehouse" | farmwords=="Hay" | farmwords=="Hayloft")
replace occupation="Farmer" if (person=="Man" | person=="Woman") & (farmwords=="Pigs" | farmwords=="Pigsty" | farmwords=="Stable, Pen" | farmwords=="Chicken Coop")
replace occupation="Farmer" if (person=="Man" | person=="Woman") & (farmwords=="Stable")
replace octype="Farming" if (person=="Man" | person=="Woman") & (farmwords=="Goat Shed, Storehouse" | farmwords=="Hay" | farmwords=="Hayloft")
replace octype="Farming" if (person=="Man" | person=="Woman") & (farmwords=="Pigs" | farmwords=="Pigsty" | farmwords=="Stable, Pen" | farmwords=="Chicken Coop")
replace octype="Farming" if (person=="Man" | person=="Woman") & (farmwords=="Stable")

********************** Define occupational status: 1-3

* count if octype=="Resistance" & pwoctype!="Resistance" & pwoctype!=""

gen ocstatus = ""
replace ocstatus = "agrforestfish" if octype=="Farming" | octype=="Forestry" | octype=="Fishing"
replace ocstatus = "minmancommtrandmst" if octype=="Mining" | octype=="Manufacturing" | octype=="Commerce" | octype=="Transportation" | octype=="Domestic"
replace ocstatus = "proflibpubserv" if octype == "Liberal Profession" | octype =="Public Service" | octype=="Public Servant" | octype=="Education" 

/*
                            octype |      Freq.     Percent        Cum.
-----------------------------------+-----------------------------------
                              Army |         20        0.66        0.66 DD
          Army, Liberal Profession |          1        0.03        0.69
                  Army, Resistance |          1        0.03        0.72 DD
                             Child |        840       27.54       28.26 DD
                            Clergy |         53        1.74       30.00 DD
                          Commerce |        171        5.61       35.61 DD
                          Domestic |         89        2.92       38.52 DD
                         Education |         91        2.98       41.51 DD
                Education, Farming |          1        0.03       41.54 DD
     Education, Liberal Profession |          1        0.03       41.57 DD
          Education, Manufacturing |          1        0.03       41.61 DD
                           Farming |      1,051       34.46       76.07 DD
            Farming, Manufacturing |          1        0.03       76.10 DD
           Farming, Transportation |          1        0.03       76.13 DD
                           Fishing |          1        0.03       76.16 DD
                          Forestry |         16        0.52       76.69 DD
                 Forestry, Farming |          2        0.07       76.75 DD
                Liberal Profession |        160        5.25       82.00 DD
          Liberal Profession, Army |          1        0.03       82.03 DD
      Liberal Profession, Commerce |          1        0.03       82.07 DD
Liberal Profession, Public Service |          3        0.10       82.16 DD
                     Manufacturing |        208        6.82       88.98 DD
           Manufacturing, Commerce |          1        0.03       89.02 DD
            Manufacturing, Farming |          4        0.13       89.15 DD
                            Mining |          5        0.16       89.31 DD
                         Policeman |         11        0.36       89.67
                    Public Service |         46        1.51       91.18 DD
                        Resistance |        207        6.79       97.97 DD
                           Student |         13        0.43       98.39 DD
                    Transportation |         49        1.61      100.00 DD
-----------------------------------+-----------------------------------
                             Total |      3,050      100.00

*/







*** Intra-status combination pairs
/*
Forestry, Farming |          2
Manufacturing, Commerce |          1
Guard, Manufacturing |		1
Education, Liberal Profession |          1
Liberal Profession, Public Service |          3
*/
replace ocstatus = "agrforestfish" if octype=="Forestry, Farming"
replace ocstatus = "minmancommtrandmst" if octype=="Manufacturing, Commerce" 
replace ocstatus = "proflibpubserv" if octype=="Education, Liberal Profession" | octype=="Liberal Profession, Public Service"

*** Inter-status combination pairs. Divide between 2 status groups equally. When odd #, assign to lower status.

* 1-2
/*
Farming, Manufacturing |          1
Farming, Transportation |          1
Manufacturing, Farming |          4
list name if octype=="Manufacturing, Farming"
 139. |  Franciszek Baran |
2892. | Henryk Malkiewicz |
3527. | Tadeusz Pastuszka |
3673. |  Franciszek Pilat |
*/
replace ocstatus ="agrforestfish" if octype=="Farming, Manufacturing" | octype=="Farming, Transportation" | name=="Franciszek Baran"
replace ocstatus="minmancommtrandmst" if octype=="Manufacturing, Farming" & name!="Franciszek Baran"
 
* 1-3
/*
Education, Farming |          1
*/
replace ocstatus ="agrforestfish" if octype=="Education, Farming"

* 2-3
/*
Education, Manufacturing |          1
Liberal Profession, Commerce |          1
*/
replace ocstatus="minmancommtrandmst" if octype=="Education, Manufacturing"
replace ocstatus="proflibpubserv" if octype=="Liberal Profession, Commerce"


label var  obs "Observation number"
label var year "Year recognized as Righteous Among the Nations"
label var names "Names of rescuers in family"
label var name "Rescuer name"
label var fname "First name"
label var person "Man woman or child"
label var occupation "Occupation"
label var octype "Occupation type"
label var farmwords "Farm-related words"
label var pwoccupation "Occupation before the war"
label var pwoctype "Occupation type before the war"
label var ocstatus "Occupational status"




tab ocstatus if person=="Man" | person=="Woman"





